home *** CD-ROM | disk | FTP | other *** search
/ .net (French) 1996 November / .net Magazine (FR) - Issue 01 - Nov 1996.iso / mac / Edition Web / HTMLedit173-ppc / HTML.edit 1.7.3 (ppc) / HTML.edit 1.7.3 (ppc).rsrc / TEXT_18408_Hosts File.txt < prev    next >
Text File  |  1996-09-16  |  3KB  |  31 lines

  1.  
  2. Prototyping Your Pages Using the Hosts File
  3.  
  4. Assuming your HTTP server and your development workstation are two different machines, one way of prototyping a fully operational system (with graphics, active links, CGIs, etc.) without making it available publicly on the Web, is to fool your browser into looking to your workstation rather than the server.
  5.  
  6. Machines on the Internet use IP numbers as a reference for communicating, looking up those IP numbers in a Domain Name System or DNS. The "hosts" file is a text file residing in your system folder that is used as a reference for looking up server names. It is a simple cross reference of server name to IP number. Your workstation looks to your hosts file for the IP lookup before trying elsewhere. If no reference to your server is made in the hosts file, the name lookup is handled by either your local (ie., site) DNS registry (probably a UNIX router, if you have one), or external to your site by some gateway to the Internet.
  7.  
  8. By including in the hosts file an IP reference to your server, substituting the IP number of your workstation for the IP number of your server, you bypass the normal lookup and "fool" your browser into using your workstation rather than the server. You must, of course, have an HTTP server (such as MacHTTP or WebStar) up and running on your workstation for this to work.
  9.  
  10. An Example
  11.  
  12. You can put a reference to your HTTP server into your hosts file by appending a single line to the existing hosts file. As an example, for a server named "www.foo.edu" with an IP number of 198.187.121.23, the line would look like:
  13.  
  14.     www.foo.edu     A     198.187.121.23      ;ref to real server
  15.  
  16. using spaces as whitespace between the three items (text after a semicolon is considered a comment and ignored).
  17.  
  18. If your workstation IP number was 198.187.121.160, you would change the "normal" operation of looking to the real server, and fool it into looking to the prototype server on your workstation by changing the line in the hosts file to
  19.  
  20.    www.foo.edu     A     198.187.121.160     ;ref to fake server
  21.  
  22. and rebooting your Macintosh (you must reboot between changes).
  23.  
  24. Now, run the HTTP server on your workstation (MacHTTP, WebStar, etc.) and when your browser makes references to your server, the hosts file will direct them to your workstation.
  25.  
  26. When you want to switch back to referring to the "real" server, change the hosts file back to the IP number of your server (or comment out the line) and reboot.
  27.  
  28. Anything on a line after a semicolon in the hosts file is ignored, so I generally have two lines, and just comment out the one I'm not using.
  29.  
  30. Back to Setting Up a Web Server, on to Paths and Filenames, or return to Design Issues.
  31.